import Tabbar from '../components/tabbar/index.vue'
import searchNav from '../components/navbar/searchNav.vue'
import backNav from '../components/navbar/backNav.vue'
import mineNav from '../components/navbar/mineNav.vue'
import myStudy from '../views/mystudy'
import Login from '../views/login/index.vue'
import coursesNav from '../components/navbar/coursesNav.vue'
import SearchNoNav from '../components/navbar/searchNoNav.vue'
import RecList from '../views/recentlist/reclist.vue'
import CacheList from '../views/recentlist/cacheList'
import Collection from '../views/recentlist/collection.vue'
import DetailRecent from '../views/mystudy/detailRecent'
import PayDetail from '../views/recentlist/Paydetail.vue'
import Fn from '../views/fn/fn.vue'
import Fnvv from '../views/fn/fnvv.vue'
import Xqy from '../views/recentlist/xqy.vue'

const routes = [
  // {
  //   path: '/login',
  //   components: { // 使用命名视图，指定在哪个名称的视图中渲染什么组件
  //     header: Navbar,
  //     default: () => import('../views/login/index.vue'),
  //   },
  //   meta: {
  //     title: '用户登录',
  //   },
  // },
  {
    path: '/',
    redirect: '/start',
  },

  {
    path: '/start',
    // component: () => import('../views/start'),
    component: () => import('../views/start/index.vue'),
  },
  {
    path: '/login',
    component: Login,
  },
  {
    path: '/home',
    components: {
      default: () => import('../views/home/index.vue'),
      footer: Tabbar,
      header: searchNav,
    },
    meta: {
      title: '首页',
      icon: 'home-o',
      inMenu: true,
    },
  },

  {
    path: '/home/hotCourses',
    components: {
      default: () => import('../views/home/hotCourses.vue'),
      header: coursesNav,
    },
    meta: {
      title: '热门好课',
    },
  },
  {
    path: '/home/free',
    components: {
      default: () => import('../views/home/free.vue'),
      header: coursesNav,
    },
    meta: {
      title: '免费专区',
    },
  },
  {
    path: '/home/discount',
    components: {
      default: () => import('../views/home/discount.vue'),
      header: coursesNav,
    },
    meta: {
      title: '限时优惠',
    },
  },

  {
    path: '/home/excelCourses',
    components: {
      default: () => import('../views/home/excelCourses.vue'),
      header: coursesNav,
    },
    meta: {
      title: '精品课程',
    },
  },
  {
    path: '/search',
    components: {
      default: () => import('../views/search/search.vue'),
      header: SearchNoNav,
    },
    meta: {
      title: '搜索',
    },
  },
  {
    path: '/search/relevant',
    components: {
      default: () => import('../views/search/relevant.vue'),
      header: SearchNoNav,
    },
    meta: {
      title: '相关搜索',
    },
  },
  {
    path: '/fn',
    components: { default: Fn, header: searchNav, footer: Tabbar },
  },
  {
    path: '/fnvv',
    components: { default: Fnvv, header: coursesNav },
    meta: {
      title: '平面设计',
    },
  },
  {
    path: '/mystudy',
    components: {
      header: mineNav,
      default: myStudy,
      footer: Tabbar,
    },
    meta: {
      needPermission: true,
    },
  },
  {
    path: '/reclist',
    components: {
      default: RecList,
      header: coursesNav,
    },
    meta: {
      title: '最近在学',
    },
  },
  {
    path: '/user',
    components: {
      default: () => import('../views/user/index.vue'),
      footer: Tabbar,
    },
    meta: {
      needPermission: true,
    },
  },
  {
    path: '/unlogin',
    components: {
      default: () => import('../views/user/unlogin.vue'),
      footer: Tabbar,
    },
  },
  {
    path: '/coupons',
    components: {
      default: () => import('../views/user/coupons/coupons.vue'),
    },
  },
  {
    path: '/promote',
    components: {
      default: () => import('../views/user/promote/promote.vue'),
    },
  },
  {
    path: '/earnings',
    components: {
      default: () => import('../views/user/promote/earnings.vue'),
    },
  },
  {
    path: '/balance',
    name: 'balance',
    component: () => import('../views/user/balance/balance.vue'),
  },
  {
    path: '/setting',
    component: () => import('../views/user/setting/setting.vue'),
  },
  {
    path: '/update',
    component: () => import('../views/user/modify/update.vue'),
  },
  {
    path: '/modifyName',
    component: () => import('../views/user/modify/modifyName'),
  },
  {
    path: '/consult',
    component: () => import('../views/user/consult/consult'),
  },
  {
    path: '/order',
    component: () => import('../views/user/order/order'),
  },
  {
    path: '/confirm',
    component: () => import('../views/user/order/confirm'),
  },
  {
    path: '/payment-succeeded',
    component: () => import('../views/user/order/payment-succeeded'),
  },
  {
    path: '/details',
    component: () => import('../views/details/index.vue'),
  },
  {
    path: '/article',
    components: {
      default: () => import('../views/article/index.vue'),
      header: coursesNav,
      footer: Tabbar,
    },
    meta: {
      title: '文章',
    },
  },
  {
    path: '/cacheList',
    components: {
      default: CacheList,
      header: coursesNav,
    },
    meta: {
      title: '我的缓存',
    },
  },
  {
    path: '/collection',
    components: { default: Collection, header: coursesNav },
    meta: {
      title: '我的收藏',
    },
  },
  {
    path: '/detailRecent',
    component: DetailRecent,
  },
  {
    path: '/paydetail',
    component: PayDetail,
  },
  {
    path: '/recList',
    components: {
      default: RecList,
      header: coursesNav,
    },
    meta: {
      title: '最近在学',
    },
  },
  {
    path: '/details',
    component: () => import('../views/details/index.vue'),
  },
  {
    path: '/details/search',
    components: {
      default: () => import('../views/search/search.vue'),
      header: SearchNoNav,
    },
  },
  {
    path: '/select',
    components: {
      default: () => import('../views/select/select.vue'),
      header: backNav,
    },
    meta: {
      title: '兴趣选择',
    },
  },
  {
    path: '/xqy',
    component: Xqy,
  },
  {
    path: '/detail',
    component: () => import('../views/user/promote/detail.vue'),
  },
]

export default routes
